﻿<%@ Page Title="" Language="C#" MasterPageFile="~/resumemanager/resume.master" Inherits="WebManager.BasePage" %>

<%@ Import Namespace="TalentPools.Model" %>
<%@ Import Namespace="TalentPools.BLL" %>
<script runat="server">
    string username;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!MyUserLogin()) //判断个人用户是否登录
        {
            JsWindows("请先登录", "../Index.aspx");
            return;
        }
        username = Server.UrlDecode(Request.Cookies["User"].Values["name"]);
        BindData(username);

    }

    private void BindData(string username)
    {
        lblresumeNum.Text = new checkresumeManager().getcountByname(username).ToString();
        lblcount.Text = (5 - Convert.ToInt32(lblresumeNum.Text)).ToString();
        rptresume.DataSource = new checkresumeManager().GetResumeByUserName(username);
        rptresume.DataBind();
    }
    public string getstatus(int i)
    {
        if (i == 0)
        {
            return "不公开";
        }
        return "公开";
    }

    protected void rptresume_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandArgument == "delete")
        {
            HiddenField hfId = e.Item.FindControl("hfId") as HiddenField;
            int resumeId = Convert.ToInt32(hfId.Value);
            new SkillManager().DeleteSkill(resumeId);
            new RecordManager().DeleteRecord1(resumeId);
            new IntentionManager().deleteinten(resumeId);
            new CustomManager().DeleteCustom1(resumeId);
            new TrainingManager().DeleteTraining1(resumeId);
            new checkresumeManager().deletResumeByid(resumeId);
            BindData(username);
        }
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="showmyresume">
        <span style="font-size: 13px; color: Red;">你现在有<asp:Label ID="lblresumeNum" runat="server"></asp:Label>份简历，还可以创建<asp:Label
            ID="lblcount" runat="server"></asp:Label>份</span>
        <asp:Repeater ID="rptresume" runat="server" OnItemCommand="rptresume_ItemCommand">
            <HeaderTemplate>
                <table class="tableMain border" style="width: 100%">
                    <tr class="topbg2">
                        <td class="titleStyle" style="text-align: center; width: 20%;">
                            简历名称
                        </td>
                        <td class="valStyle" style="text-align: center; width: 20%;">
                            更新时间
                        </td>
                        <td class="textStyle" style="text-align: center; width: 15%;">
                            简历状态
                        </td>
                        <td class="editStyle" style="width: 15%">
                            操作
                        </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr  class="tdbg">
                    <td class="titleStyle" style="text-align: center; width: 20%;">
                        <%#Eval("resumeName") %>
                    </td>
                    <td class="valStyle" style="text-align: center; width: 20%;">
                        <%#WebManager.BasePage.SetTimeFormat(Convert.ToDateTime(Eval("lastUpdateTime"))) %>
                    </td>
                    <td class="textStyle" style="text-align: center; width: 15%;">
                        <%#getstatus(Convert.ToInt32(Eval("isPublic"))) %>
                    </td>
                    <td class="editStyle" style="width: 15%">
                        <a href='ShowResume.aspx?id=<%#Eval("Id") %>' style="text-decoration: none;">
                            预览</a> |
                        <a href='Edit.aspx?id=<%#Eval("Id") %>'>修改</a>
                        |
                        <asp:LinkButton ID="lbtnDelete" runat="server" CommandArgument="delete" OnClientClick="return confirm('删除简历将会删除该简历的所有信息，此操作不可逆！')">删除</asp:LinkButton>
                        <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("Id") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table></FooterTemplate>
        </asp:Repeater>
    </div>

</asp:Content>
